package org.yang.database.orm.entity;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 *  分页查询条件
 *
 * @author: lslands
 * @description:
 * @since：v1.0
 * @date: 2024/5/20 09:45
 */
@Data
@NoArgsConstructor
public class BaseQuery implements Serializable {

    /**
     * 当前页
     * @mock 1
     */
    private long current=1;
    /**
     * 每页条数
     *  @mock 10
     */
    private long size=10;
    /**
     *  进行排序的字段
     *  @mock id
     */
    private String orderField="id";

    /**
     * 排序类型：desc降序，升序,默认降序
     *  @mock desc
     */
    private String order="desc";

    /**
     * 游标(把上一页最后数据ID记录)
     */
    private String cursor;


    public BaseQuery(long current, long size) {
        this.current = current;
        this.size = size;
    }

    public BaseQuery(long current, long size, String orderField) {
        this.current = current;
        this.size = size;
        this.orderField = orderField;
    }

    public BaseQuery(long current, long size, String orderField, String order) {
        this.current = current;
        this.size = size;
        this.orderField = orderField;
        this.order = order;
    }
}
